import React from 'react';
import { connect } from 'react-redux';
import { View, Text, Image } from '@tarojs/components';
import Taro from '@tarojs/taro';
import Icon from '@/components/Icon';
import { customeColor } from '@/src/config';
import pSucceed from '@/images/common/succeed.png';
import Info from '../detail/info/index';
import './index.scss';

const ApplyResult = ({ applyResult = {} }) => {
  const goDetail = () => {
    let url = '/orderSubPack/afterSale/detail/index' + '?' + 'id=' + applyResult.id;
    Taro.navigateTo({ url });
  };

  const goOrder = () => {
    let url = '/orderSubPack/order-list/index';
    Taro.navigateTo({ url });
  };

  applyResult.created = applyResult.createTime;
  applyResult.userMobile = applyResult.mobile;
  return (
    <View className="ApplyResult flex-column--center">
      <View className="resultInfo">
        <View className="status flex-row--center">
          <Image className="rIcon" src={pSucceed} />
          <Text className="title">售后申请成功</Text>
        </View>
        <View className="des">您的申请提交成功，正在等待商家审核，请耐心等待！</View>
        <View className="ops flex-row">
          <View
            className="op diliver flex-row-center-center"
            onClick={() => {
              goDetail();
            }}
          >
            <Icon name="icon_dingdan" size={24} color={customeColor} />
            <Text className="btxt customePageStyle">查看详情</Text>
          </View>
          <View
            className="op flex-row-center-center"
            onClick={() => {
              goOrder();
            }}
          >
            <Icon name="icon_chakan" size={24} color={customeColor} />
            <Text className="btxt customePageStyle">我的订单</Text>
          </View>
        </View>
      </View>
      <Info detail={applyResult} isResult />
    </View>
  );
};

export default connect(({ order }) => ({
  applyResult: order.applyResult,
}))(ApplyResult);
